package o;

import android.content.Intent;
import androidx.annotation.NonNull;
import com.huawei.appgallery.purchasehistory.api.bean.PurchaseInfoBean;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ebz {
    private static ebz ˎ;
    private static final Object ˏ = new Object();
    public static final String ॱ = (ContentManager.getInstant().getContext().getPackageName() + ".broadcast.pay.PAY_DATA_CHANGE");
    private Map<String, String> ˊ = new HashMap();

    public static ebz ॱ() {
        ebz o_ebz;
        synchronized (ˏ) {
            if (ˎ == null) {
                ˎ = new ebz();
            }
            o_ebz = ˎ;
        }
        return o_ebz;
    }

    public boolean ˎ(String str) {
        if (str == null || !this.ˊ.containsKey(str)) {
            return false;
        }
        if (Logger.ˎ()) {
            Logger.ˏ("PayDataProvider", "isOrderedPkg packageName=" + str + " has been ordered");
        }
        return true;
    }

    public void ˋ(List<PurchaseInfoBean> list) {
        if (!CollectCheck.isEmpty((List) list)) {
            Map hashMap = new HashMap();
            ॱ().ˎ();
            for (PurchaseInfoBean purchaseInfoBean : list) {
                hashMap.put(purchaseInfoBean.ॱ(), purchaseInfoBean.ˋ());
            }
            ˋ(hashMap);
            dvq.ˊ(ContentManager.getInstant().getContext(), null, 0);
            ecq.ˎ(list);
        } else if (Logger.ˎ()) {
            Logger.ˏ("PayDataProvider", "addAllOrderedInfo interrupt , tradeInfos of GetBuyHistoryResBean  is empty");
        }
    }

    private void ˋ(@NonNull Map<String, String> map) {
        if (Logger.ˎ()) {
            Logger.ˏ("PayDataProvider", "addPurchaseInfoList=" + map.size());
        }
        this.ˊ.putAll(map);
        ˏ();
    }

    public void ˋ(String str, String str2) {
        if (str != null) {
            if (Logger.ˎ()) {
                Logger.ˏ("PayDataProvider", "addOrderedInfo packageName=" + str);
            }
            this.ˊ.put(str, str2);
            ˏ();
        }
    }

    public void ˋ(String str) {
        if (str != null) {
            if (Logger.ˎ()) {
                Logger.ˏ("PayDataProvider", "removeOrderedInfo packageName=" + str);
            }
            this.ˊ.remove(str);
            ˏ();
        }
    }

    public void ˎ() {
        if (Logger.ˎ()) {
            Logger.ˏ("PayDataProvider", "clearOrderedInfo");
        }
        this.ˊ.clear();
        dss.ॱ().ˏ(ContentManager.getInstant().getContext(), false, false);
    }

    private void ˏ() {
        Intent intent = new Intent(ॱ);
        ArrayList arrayList = new ArrayList();
        arrayList.addAll(this.ˊ.keySet());
        intent.putStringArrayListExtra("payDataChange", arrayList);
        ll.ˏ(ContentManager.getInstant().getContext()).ˋ(intent);
        dss.ॱ().ˏ(ContentManager.getInstant().getContext(), false, false);
    }
}
